function checkName() {
    var name = document.myform.name.value;
    var nametab = document.getElementById('nametab');
    if(/^[\u4e00-\u9fa5_a-zA-Z0-9]{2,18}$/.test(name)){
        nametab.innerHTML = '√';
        nametab.style.color = '#0a0';
        return true;
    }else{
        nametab.innerHTML = '×';
        nametab.style.color = '#f00';
        return false;
    }
}

function checkMname() {
    var mname = document.myform.mname.value;
    var mnametab = document.getElementById('mnametab');
    if(/^[_a-zA-Z0-9]+$/.test(mname)){
        mnametab.innerHTML = '√';
        mnametab.style.color = '#0a0';
        return true;
    }else{
        mnametab.innerHTML = '×';
        mnametab.style.color = '#f00';
        return false;
    }
}

function checkAname() {
    var aname = document.myform.aname.value;
    var anametab = document.getElementById('anametab');
    if(/^[_a-zA-Z0-9]+$/.test(aname)){
        anametab.innerHTML = '√';
        anametab.style.color = '#0a0';
        return true;
    }else{
        anametab.innerHTML = '×';
        anametab.style.color = '#f00';
        return false;
    }
}

// 表单提交验证
function checkForm() {
    return checkName() && checkMname() && checkAname();
}